@@ -- Add Express V4 Support to @salesforce/mrt-utilities package.#334
Merged
@@ -- Add Express V4 Support to @salesforce/mrt-utilities package.#334
@salesforce/mrt-utilities package.#334Conversation
@salesforce/mrt-utilities package.@salesforce/mrt-utilities package.
clavery
approved these changes
Apr 10, 2026
clavery
requested changes
Apr 10, 2026
Collaborator
There was a problem hiding this comment.
actually @bendvc can you add a changeset (instructions in readme and claude/agents.md)
changeset triggers the version bump
clavery
approved these changes
Apr 10, 2026
kieran-sf
reviewed
Apr 10, 2026
| // Hand off to the next middleware | ||
| next(); | ||
| // Apply custom query parameter parsing and forward errors via next() | ||
| processIncomingRequest(req, res) |
Contributor
There was a problem hiding this comment.
Can you explain the reason for the change here, I am just curious
Collaborator
Author
There was a problem hiding this comment.
We made that change so this middleware works in Express 4.
Express 4 doesn’t always handle async errors, so we now call processIncomingRequest(...) and only call next() after it finishes, and if it fails we pass the error to next(err). This keeps the same behaviour but avoids unhandled promise errors. The function signature isn't changed, so we don't have a breaking change.
kieran-sf
approved these changes
Apr 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Here’s the updated PR description reflecting the new “import both versions” approach:
Summary
createMRTRequestProcessorMiddlewareby forwarding async errors vianext(err)while keeping the same public API.@salesforce/mrt-utilitiesExpress peer range to support both v4 and v5, and run Express-related tests against both versions in a single test run.Details
peerDependencies.expressnow allows^4.18.2 || ^5.0.0, with dev aliases for bothexpress4andexpress5used in tests.createMRTRequestProcessorMiddlewarenow forwards async errors vianext(err)for Express 4 compatibility.x-mobify-querystring, cleanup middleware behavior, and static asset headers.Test Plan
pnpm --filter @salesforce/mrt-utilities run buildpnpm --filter @salesforce/mrt-utilities run testNotes
pnpm-lock.yamlupdated due to new dev dependency aliases.